import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/payPlan/add',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/payPlan/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/payPlan/update',
    method: 'post',
    data
  })
}

export function getById(id) {
  return request({
    url: 'api/payPlan/getById/' + id,
    method: 'get'
  })
}

export function getPlanBrand(params) {
  return request({
    url: 'api/payGoodBrand/getPlanBrand',
    method: 'get',
    params: params
  })
}

export function getPlanGoodsType(params) {
  return request({
    url: 'api/payGoodType/getPayGoodTypes',
    method: 'get',
    params: params
  })
}

export function listGoodsByBrandId(params) {
  return request({
    url: 'api/payGoodBrand/list-goods-by-brandId',
    method: 'get',
    params: params
  })
}

export function listGoodsByTypeId(params) {
  return request({
    url: 'api/payGoodType/list-goods-by-typeId',
    method: 'get',
    params: params
  })
}
export function enableOrDisable(data) {
  const obj = {
    url: 'api/payPlan/enableOrDisable',
    method: 'post',
    data
  }
  return request(obj)
}
export default { add, del, edit, enableOrDisable }

